﻿using BMSQ.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BMSQ.Admin.Others.APP
{
    public partial class AddAPPVersion : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (this.txtVer_ID.Text.Trim().Length == 0)
            {
                strErr += "Ver_ID不能为空！\\n";
            }
            if (this.txtVersion_Number.Text.Trim().Length == 0)
            {
                strErr += "Version_Number不能为空！\\n";
            }
            if (this.txtDownLoad_Path.Text.Trim().Length == 0)
            {
                strErr += "DownLoad_Path不能为空！\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string Ver_ID = this.txtVer_ID.Text;
            string Version_Number = this.txtVersion_Number.Text;
            int APP_Type = int.Parse(ddlAPPType.SelectedValue);
            string DownLoad_Path = this.txtDownLoad_Path.Text;
            DateTime Created_Date = DateTime.Now;
            int NewVersion = 1;

            Model.APP_Version model = new Model.APP_Version();
            model.Ver_ID = Ver_ID;
            model.Version_Number = Version_Number;
            model.APP_Type = APP_Type;
            model.DownLoad_Path = DownLoad_Path;
            model.Created_Date = Created_Date;
            model.NewVersion = NewVersion;

            BLL.APP_Version bll = new BLL.APP_Version();
            bll.Add(model);
           MessageBox.ShowAndRedirect(this, "保存成功！", "add.aspx");
        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("APPVersionList.aspx");
        }
    }
}